<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>

<html:html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>.: Sistem Information of School :.</title>
        <script language="JavaScript">
            var isEmpty = "<bean:message key="label.isEmpty"/>";
            function validate_login_form(){
                if ( document.UserForm.userName.value == "" ){
                    alert ( "<bean:message key="user.userName"/> "+isEmpty );
                }else if ( document.UserForm.password.value == "" ){
                    alert ( "<bean:message key="user.password"/> "+isEmpty );
                }else if ( document.UserForm.departement.value == "" ){
                    alert ( "<bean:message key="user.departement"/> "+isEmpty );
                }else {
                    document.UserForm.submit();
                }
            }
        </script>
    </head>
    <body topmargin="0" leftmargin="0" rightmargin="0">
        <table width="100%"  border="0" cellpadding="0" cellspacing="0" height="100%">
            <tr height="20%">
                <td>&nbsp;</td>
            </tr>
            <tr height="*">
                <td align="center" valign="middle" height="*">
                    <html:messages id="msg" message="true">
                        <bean:write name="msg"/>
                    </html:messages>
                    <table border="1" cellpadding="0" cellspacing="0" width="25%" height="20%" bgcolor="#FFFF99">
                        <tr>
                            <td valign="middle" align="center">
                                <html:form action="login">
                                    <table border="0" cellpadding="4" cellspacing="0">
                                        <tr>
                                            <td colspan="3">
                                                <img src="page/images/login.png"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td><bean:message key="user.userName"/></td>
                                            <td>:</td>
                                            <td><html:text property="userName" size="20"/></td>
                                        </tr>
                                        <tr>
                                            <td><bean:message key="user.password"/></td>
                                            <td>:</td>
                                            <td><html:password property="password" size="20"/></td>
                                        </tr>
                                        <tr>
                                            <td><bean:message key="user.departement"/></td>
                                            <td>:</td>
                                            <td>
                                                <html:select property="departement">
                                                    <logic:iterate id="listDepartement" name="listDepartement">
                                                        <option value="<bean:write name="listDepartement" property="id"/>"><bean:write name="listDepartement" property="namaBagian"/></option>
                                                    </logic:iterate>
                                                </html:select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3"><input type="button" value="${buttonLogin}" onclick="validate_login_form()"/></td>
                                        </tr>
                                    </table>
                                </html:form>
                            </td>
                        </tr>
                    </table>
                    <small><bean:message key="label.copyright"/></small>
                </td>
            </tr>
            <tr height="10%">
                <td>&nbsp;</td>
            </tr>
        </table>
    </body>
</html:html>
